import { eventHandler } from 'h3';

export default eventHandler(async (event) => {
  const { status, name, defaultRouter, remark, sort } = await readBody(event);
  // 新增数据
  MOCK_ROLE_LIST_DATA.unshift({
    id: MOCK_ROLE_LIST_DATA.length + 1,
    createdAt: Date.now(),
    updatedAt: Date.now(),
    status,
    name,
    defaultRouter,
    remark,
    sort,
  });

  return useResponseSuccess({
    message: '新增语料成功',
    data: {
      status,
      name,
      defaultRouter,
      remark,
      sort,
    },
  });
});
